﻿using Pb;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChiListMode : MonoBehaviour {
    public List<GameObject> ListChiCard;
    public List<ChiCardItemModel> cardItem;
    public List<GameObject> sign;
    
    private void Awake()
    {
        UIEventListener.Get(ListChiCard[0]).onClick = ButtonClick;
        UIEventListener.Get(ListChiCard[1]).onClick = ButtonClick;
        UIEventListener.Get(ListChiCard[2]).onClick = ButtonClick;
    }
    void ButtonClick(GameObject button)
    {
        if (button.name == "List1")
        {
            Debug.Log("1");
            foreach (GameObject i in sign) {
                if (i.name == "sign1")
                {
                    i.SetActive(true);
                }
                else {
                    i.SetActive(false);
                }
            }
            SpecialCardModel.SelectIndex = 0;
        }
        else if (button.name == "List2") {
            Debug.Log("2");
            foreach (GameObject i in sign)
            {
                if (i.name == "sign2")
                {
                    i.SetActive(true);
                }
                else
                {
                    i.SetActive(false);
                }
            }
            SpecialCardModel.SelectIndex = 1;
        }
        else if (button.name == "List3")
        {
            foreach (GameObject i in sign)
            {
                if (i.name == "sign3")
                {
                    i.SetActive(true);
                }
                else
                {
                    i.SetActive(false);
                }
            }
            SpecialCardModel.SelectIndex = 2;
        }
    }
    public void LoadCardList(List<MahjongSpecialCardItem> tempList,int tempIntChi)
    {
        //for (int i=0;i< tempIntChi; i++) {
        //    if (tempList[i].ActionType == MAHJONG_ACTION_TYPE.Chi) {
        //        List<int> tempIntList = new List<int>();
        //        tempIntList.Add(tempList[i].TargetCard);
        //        tempIntList.Add(tempList[i].SiblingCardList[0]);
        //        tempIntList.Add(tempList[i].SiblingCardList[1]);
        //        tempIntList.Sort();
        //        ListChiCard[i].SetActive(true);
        //        cardItem[i].LoadCard(tempIntList);
        //    }
            
        //}
    }
}
